package com.xyj.zjbz.util;

import org.springframework.util.Assert;
/**
 * 数据源切换类
 * 
 * @author 李朝衡
 *
 */
public class DataSourceSwitcher {
	private static final ThreadLocal<String> thread = new ThreadLocal<String>();
	/**
	 * 切换
	 * @param type
	 */
	public static void setDataSource(String type) {
		Assert.notNull(type, "type 参数为空");
		thread.set(type);
	}

	public static String getDataSourceName() {
		return (String) thread.get();
	}

	public static void removeDataSource() {
		thread.remove();
	}
}
